package com.ficus.road.maintain.strategy.operationlog;

import com.alibaba.fastjson.JSONArray;
import com.ficus.road.maintain.core.model.OperationLog;
import com.ficus.road.maintain.operationlog.model.HitRecheckRequest;
import org.apache.commons.lang3.ObjectUtils;

/**
 * @author xiawen yang
 * @date 2021/12/24 上午11:15
 */
public class HitRecheckStrategy implements OperationLogStrategy {
    @Override
    public Object processRequestParam(String jsonString) {
        HitRecheckRequest hitRecheckRequest = new HitRecheckRequest();
        JSONArray jsonArray = JSONArray.parseArray(jsonString);
        if (ObjectUtils.isNotEmpty(jsonArray)) {
            String hitId = jsonArray.getString(0);
            String resultNum = jsonArray.getString(1);
            String remarks = jsonArray.getString(2);
            hitRecheckRequest = HitRecheckRequest.builder().hitId(hitId).resultNum(resultNum).remarks(remarks).build();
        }
        return hitRecheckRequest;
    }

    // 不处理
    @Override
    public Object processResponse(String returnString, OperationLog operationLog) {
        return returnString;
    }

}
